package com.sky.mapper;

import com.sky.entity.Employee;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmployeeMapper {

    //通过username查询
    String getByUsername = "SELECT * FROM employee WHERE username=#{username}";
    @Select(getByUsername)
    Employee getByUsername(String username);

    //列表查询
    List<Employee> getList(String name);

    //手机号重复性验证
    @Select("select * from employee where phone=#{phone}")
    Employee getByPhone(String phone);
    //身份证重复性验证
    @Select("select * from employee where id_number=#{idNumber}")
    Employee getByIdNumber(String idNumber);

    //添加员工
    void insert(Employee employee);

    //通过id查询(回显)
    @Select("select * from employee where id = #{id}")
    Employee getById(Long id);

    // 修改
    void updateById(Employee employee);
}
